<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libcoap: encode.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">libcoap<span id="projectnumber">&#160;4.2.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('encode_8h.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">encode.h File Reference</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;strings.h&gt;</code><br />
<code>#include &lt;stdint.h&gt;</code><br />
</div>
<p><a href="encode_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a4c4631bce2e88ac803ce77b82050c8c5" id="r_a4c4631bce2e88ac803ce77b82050c8c5"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a>&#160;&#160;&#160;8  /* duplicate definition of N if built on sky motes */</td></tr>
<tr class="separator:a4c4631bce2e88ac803ce77b82050c8c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac2e4ea9e9f42cc3a61ed313887a93e1a" id="r_ac2e4ea9e9f42cc3a61ed313887a93e1a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#ac2e4ea9e9f42cc3a61ed313887a93e1a">ENCODE_HEADER_SIZE</a>&#160;&#160;&#160;4</td></tr>
<tr class="separator:ac2e4ea9e9f42cc3a61ed313887a93e1a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afa107b638e92ce549b144ad1e6923014" id="r_afa107b638e92ce549b144ad1e6923014"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#afa107b638e92ce549b144ad1e6923014">HIBIT</a>&#160;&#160;&#160;(1 &lt;&lt; (<a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a> - 1))</td></tr>
<tr class="separator:afa107b638e92ce549b144ad1e6923014"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a141aa96b8c8171928c6fda68e7434223" id="r_a141aa96b8c8171928c6fda68e7434223"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#a141aa96b8c8171928c6fda68e7434223">EMASK</a>&#160;&#160;&#160;((1 &lt;&lt; <a class="el" href="encode_8h.html#ac2e4ea9e9f42cc3a61ed313887a93e1a">ENCODE_HEADER_SIZE</a>) - 1)</td></tr>
<tr class="separator:a141aa96b8c8171928c6fda68e7434223"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a024267150211c7b91337884c12faa684" id="r_a024267150211c7b91337884c12faa684"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#a024267150211c7b91337884c12faa684">MMASK</a>&#160;&#160;&#160;((1 &lt;&lt; <a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a>) - 1 - <a class="el" href="encode_8h.html#a141aa96b8c8171928c6fda68e7434223">EMASK</a>)</td></tr>
<tr class="separator:a024267150211c7b91337884c12faa684"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ce3e2af80a76d816ab7f8567ec4a65a" id="r_a4ce3e2af80a76d816ab7f8567ec4a65a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#a4ce3e2af80a76d816ab7f8567ec4a65a">MAX_VALUE</a>&#160;&#160;&#160;( (1 &lt;&lt; <a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a>) - (1 &lt;&lt; <a class="el" href="encode_8h.html#ac2e4ea9e9f42cc3a61ed313887a93e1a">ENCODE_HEADER_SIZE</a>) ) * (1 &lt;&lt; ((1 &lt;&lt; <a class="el" href="encode_8h.html#ac2e4ea9e9f42cc3a61ed313887a93e1a">ENCODE_HEADER_SIZE</a>) - 1))</td></tr>
<tr class="separator:a4ce3e2af80a76d816ab7f8567ec4a65a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7af00aac93971fb8c36901b03d0c741c" id="r_a7af00aac93971fb8c36901b03d0c741c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#a7af00aac93971fb8c36901b03d0c741c">COAP_PSEUDOFP_DECODE_8_4</a>(r)&#160;&#160;&#160;(r &lt; <a class="el" href="encode_8h.html#afa107b638e92ce549b144ad1e6923014">HIBIT</a> ? r : (r &amp; <a class="el" href="encode_8h.html#a024267150211c7b91337884c12faa684">MMASK</a>) &lt;&lt; (r &amp; <a class="el" href="encode_8h.html#a141aa96b8c8171928c6fda68e7434223">EMASK</a>))</td></tr>
<tr class="separator:a7af00aac93971fb8c36901b03d0c741c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6501bb15ead307a357b707f1c813e7a9" id="r_a6501bb15ead307a357b707f1c813e7a9"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#a6501bb15ead307a357b707f1c813e7a9">COAP_PSEUDOFP_ENCODE_8_4_DOWN</a>(v,  ls)&#160;&#160;&#160;(v &lt; <a class="el" href="encode_8h.html#afa107b638e92ce549b144ad1e6923014">HIBIT</a> ? v : (ls = <a class="el" href="encode_8c.html#a671b4261b2d24de8696258a8efb0f359">coap_fls</a>(v) - <a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a>, (v &gt;&gt; ls) &amp; <a class="el" href="encode_8h.html#a024267150211c7b91337884c12faa684">MMASK</a>) + ls)</td></tr>
<tr class="separator:a6501bb15ead307a357b707f1c813e7a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac516bbcf6e4658c848804ced3d9313d" id="r_aac516bbcf6e4658c848804ced3d9313d"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#aac516bbcf6e4658c848804ced3d9313d">COAP_PSEUDOFP_ENCODE_8_4_UP</a>(v,  ls,  s)&#160;&#160;&#160;(v &lt; <a class="el" href="encode_8h.html#afa107b638e92ce549b144ad1e6923014">HIBIT</a> ? v : (ls = <a class="el" href="encode_8c.html#a671b4261b2d24de8696258a8efb0f359">coap_fls</a>(v) - <a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a>, (s = (((v + ((1&lt;&lt;<a class="el" href="encode_8h.html#ac2e4ea9e9f42cc3a61ed313887a93e1a">ENCODE_HEADER_SIZE</a>&lt;&lt;ls)-1)) &gt;&gt; ls) &amp; <a class="el" href="encode_8h.html#a024267150211c7b91337884c12faa684">MMASK</a>)), s == 0 ? <a class="el" href="encode_8h.html#afa107b638e92ce549b144ad1e6923014">HIBIT</a> + ls + 1 : s + ls))</td></tr>
<tr class="separator:aac516bbcf6e4658c848804ced3d9313d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a671b4261b2d24de8696258a8efb0f359" id="r_a671b4261b2d24de8696258a8efb0f359"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#a671b4261b2d24de8696258a8efb0f359">coap_fls</a> (unsigned int i)</td></tr>
<tr class="separator:a671b4261b2d24de8696258a8efb0f359"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5732d87decbffe771159ea02a5e25488" id="r_a5732d87decbffe771159ea02a5e25488"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#a5732d87decbffe771159ea02a5e25488">coap_flsll</a> (long long i)</td></tr>
<tr class="separator:a5732d87decbffe771159ea02a5e25488"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac6a99bfca9fba0a54c252f8519c7b697" id="r_ac6a99bfca9fba0a54c252f8519c7b697"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#ac6a99bfca9fba0a54c252f8519c7b697">coap_decode_var_bytes</a> (const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *buf, unsigned int length)</td></tr>
<tr class="memdesc:ac6a99bfca9fba0a54c252f8519c7b697"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decodes multiple-length byte sequences.  <br /></td></tr>
<tr class="separator:ac6a99bfca9fba0a54c252f8519c7b697"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1f68ace3f70824f5c9427d5bfac50da3" id="r_a1f68ace3f70824f5c9427d5bfac50da3"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#a1f68ace3f70824f5c9427d5bfac50da3">coap_encode_var_safe</a> (<a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *buf, size_t length, unsigned int value)</td></tr>
<tr class="memdesc:a1f68ace3f70824f5c9427d5bfac50da3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Encodes multiple-length byte sequences.  <br /></td></tr>
<tr class="separator:a1f68ace3f70824f5c9427d5bfac50da3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82301be5300c4475190f4c40b3333109" id="r_a82301be5300c4475190f4c40b3333109"><td class="memItemLeft" align="right" valign="top"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> <a class="el" href="libcoap_8h.html#a0ac5555e3d6ef821c228a03d10b334e3">COAP_DEPRECATED</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8h.html#a82301be5300c4475190f4c40b3333109">coap_encode_var_bytes</a> (<a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *buf, unsigned int value)</td></tr>
<tr class="separator:a82301be5300c4475190f4c40b3333109"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a7af00aac93971fb8c36901b03d0c741c" name="a7af00aac93971fb8c36901b03d0c741c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7af00aac93971fb8c36901b03d0c741c">&#9670;&#160;</a></span>COAP_PSEUDOFP_DECODE_8_4</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define COAP_PSEUDOFP_DECODE_8_4</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">r</td><td>)</td>
          <td>&#160;&#160;&#160;(r &lt; <a class="el" href="encode_8h.html#afa107b638e92ce549b144ad1e6923014">HIBIT</a> ? r : (r &amp; <a class="el" href="encode_8h.html#a024267150211c7b91337884c12faa684">MMASK</a>) &lt;&lt; (r &amp; <a class="el" href="encode_8h.html#a141aa96b8c8171928c6fda68e7434223">EMASK</a>))</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8h_source.html#l00028">28</a> of file <a class="el" href="encode_8h_source.html">encode.h</a>.</p>

</div>
</div>
<a id="a6501bb15ead307a357b707f1c813e7a9" name="a6501bb15ead307a357b707f1c813e7a9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6501bb15ead307a357b707f1c813e7a9">&#9670;&#160;</a></span>COAP_PSEUDOFP_ENCODE_8_4_DOWN</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define COAP_PSEUDOFP_ENCODE_8_4_DOWN</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">v, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">ls&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(v &lt; <a class="el" href="encode_8h.html#afa107b638e92ce549b144ad1e6923014">HIBIT</a> ? v : (ls = <a class="el" href="encode_8c.html#a671b4261b2d24de8696258a8efb0f359">coap_fls</a>(v) - <a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a>, (v &gt;&gt; ls) &amp; <a class="el" href="encode_8h.html#a024267150211c7b91337884c12faa684">MMASK</a>) + ls)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8h_source.html#l00045">45</a> of file <a class="el" href="encode_8h_source.html">encode.h</a>.</p>

</div>
</div>
<a id="aac516bbcf6e4658c848804ced3d9313d" name="aac516bbcf6e4658c848804ced3d9313d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aac516bbcf6e4658c848804ced3d9313d">&#9670;&#160;</a></span>COAP_PSEUDOFP_ENCODE_8_4_UP</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define COAP_PSEUDOFP_ENCODE_8_4_UP</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">v, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">ls, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">s&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(v &lt; <a class="el" href="encode_8h.html#afa107b638e92ce549b144ad1e6923014">HIBIT</a> ? v : (ls = <a class="el" href="encode_8c.html#a671b4261b2d24de8696258a8efb0f359">coap_fls</a>(v) - <a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a>, (s = (((v + ((1&lt;&lt;<a class="el" href="encode_8h.html#ac2e4ea9e9f42cc3a61ed313887a93e1a">ENCODE_HEADER_SIZE</a>&lt;&lt;ls)-1)) &gt;&gt; ls) &amp; <a class="el" href="encode_8h.html#a024267150211c7b91337884c12faa684">MMASK</a>)), s == 0 ? <a class="el" href="encode_8h.html#afa107b638e92ce549b144ad1e6923014">HIBIT</a> + ls + 1 : s + ls))</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8h_source.html#l00046">46</a> of file <a class="el" href="encode_8h_source.html">encode.h</a>.</p>

</div>
</div>
<a id="a141aa96b8c8171928c6fda68e7434223" name="a141aa96b8c8171928c6fda68e7434223"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a141aa96b8c8171928c6fda68e7434223">&#9670;&#160;</a></span>EMASK</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define EMASK&#160;&#160;&#160;((1 &lt;&lt; <a class="el" href="encode_8h.html#ac2e4ea9e9f42cc3a61ed313887a93e1a">ENCODE_HEADER_SIZE</a>) - 1)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8h_source.html#l00024">24</a> of file <a class="el" href="encode_8h_source.html">encode.h</a>.</p>

</div>
</div>
<a id="ac2e4ea9e9f42cc3a61ed313887a93e1a" name="ac2e4ea9e9f42cc3a61ed313887a93e1a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac2e4ea9e9f42cc3a61ed313887a93e1a">&#9670;&#160;</a></span>ENCODE_HEADER_SIZE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ENCODE_HEADER_SIZE&#160;&#160;&#160;4</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8h_source.html#l00022">22</a> of file <a class="el" href="encode_8h_source.html">encode.h</a>.</p>

</div>
</div>
<a id="afa107b638e92ce549b144ad1e6923014" name="afa107b638e92ce549b144ad1e6923014"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afa107b638e92ce549b144ad1e6923014">&#9670;&#160;</a></span>HIBIT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define HIBIT&#160;&#160;&#160;(1 &lt;&lt; (<a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a> - 1))</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8h_source.html#l00023">23</a> of file <a class="el" href="encode_8h_source.html">encode.h</a>.</p>

</div>
</div>
<a id="a4ce3e2af80a76d816ab7f8567ec4a65a" name="a4ce3e2af80a76d816ab7f8567ec4a65a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4ce3e2af80a76d816ab7f8567ec4a65a">&#9670;&#160;</a></span>MAX_VALUE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MAX_VALUE&#160;&#160;&#160;( (1 &lt;&lt; <a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a>) - (1 &lt;&lt; <a class="el" href="encode_8h.html#ac2e4ea9e9f42cc3a61ed313887a93e1a">ENCODE_HEADER_SIZE</a>) ) * (1 &lt;&lt; ((1 &lt;&lt; <a class="el" href="encode_8h.html#ac2e4ea9e9f42cc3a61ed313887a93e1a">ENCODE_HEADER_SIZE</a>) - 1))</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8h_source.html#l00026">26</a> of file <a class="el" href="encode_8h_source.html">encode.h</a>.</p>

</div>
</div>
<a id="a024267150211c7b91337884c12faa684" name="a024267150211c7b91337884c12faa684"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a024267150211c7b91337884c12faa684">&#9670;&#160;</a></span>MMASK</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MMASK&#160;&#160;&#160;((1 &lt;&lt; <a class="el" href="encode_8h.html#a4c4631bce2e88ac803ce77b82050c8c5">Nn</a>) - 1 - <a class="el" href="encode_8h.html#a141aa96b8c8171928c6fda68e7434223">EMASK</a>)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8h_source.html#l00025">25</a> of file <a class="el" href="encode_8h_source.html">encode.h</a>.</p>

</div>
</div>
<a id="a4c4631bce2e88ac803ce77b82050c8c5" name="a4c4631bce2e88ac803ce77b82050c8c5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4c4631bce2e88ac803ce77b82050c8c5">&#9670;&#160;</a></span>Nn</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define Nn&#160;&#160;&#160;8  /* duplicate definition of N if built on sky motes */</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8h_source.html#l00021">21</a> of file <a class="el" href="encode_8h_source.html">encode.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ac6a99bfca9fba0a54c252f8519c7b697" name="ac6a99bfca9fba0a54c252f8519c7b697"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac6a99bfca9fba0a54c252f8519c7b697">&#9670;&#160;</a></span>coap_decode_var_bytes()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int coap_decode_var_bytes </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Decodes multiple-length byte sequences. </p>
<p><code>buf</code> points to an input byte sequence of length <code>length</code>. Returns the decoded value.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>The input byte sequence to decode from </td></tr>
    <tr><td class="paramname">length</td><td>The length of the input byte sequence</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The decoded value </dd></dl>

<p class="definition">Definition at line <a class="el" href="encode_8c_source.html#l00036">36</a> of file <a class="el" href="encode_8c_source.html">encode.c</a>.</p>

</div>
</div>
<a id="a82301be5300c4475190f4c40b3333109" name="a82301be5300c4475190f4c40b3333109"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a82301be5300c4475190f4c40b3333109">&#9670;&#160;</a></span>coap_encode_var_bytes()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> <a class="el" href="libcoap_8h.html#a0ac5555e3d6ef821c228a03d10b334e3">COAP_DEPRECATED</a> int coap_encode_var_bytes </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000003">Deprecated:</a></b></dt><dd>Use <a class="el" href="encode_8h.html#a1f68ace3f70824f5c9427d5bfac50da3" title="Encodes multiple-length byte sequences.">coap_encode_var_safe()</a> instead. Provided for backward compatibility. As <code>value</code> has a maximum value of 0xffffffff, and buf is usually defined as an array, it is unsafe to continue to use this variant if buf[] is less than buf[4].</dd></dl>
<p>For example char buf[1],oops; .. coap_encode_var_bytes(buf, 0xfff); would cause oops to get overwritten. This error can only be found by code inspection. coap_encode_var_safe(buf, sizeof(buf), 0xfff); would catch this error at run-time and should be used instead. </p>

<p class="definition">Definition at line <a class="el" href="encode_8h_source.html#l00091">91</a> of file <a class="el" href="encode_8h_source.html">encode.h</a>.</p>

</div>
</div>
<a id="a1f68ace3f70824f5c9427d5bfac50da3" name="a1f68ace3f70824f5c9427d5bfac50da3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1f68ace3f70824f5c9427d5bfac50da3">&#9670;&#160;</a></span>coap_encode_var_safe()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int coap_encode_var_safe </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Encodes multiple-length byte sequences. </p>
<p><code>buf</code> points to an output buffer of sufficient length to store the encoded bytes. <code>value</code> is the value to encode. Returns the number of bytes used to encode <code>value</code> or 0 on error.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>The output buffer to decode into </td></tr>
    <tr><td class="paramname">length</td><td>The output buffer size to encode into (must be sufficient) </td></tr>
    <tr><td class="paramname">value</td><td>The value to encode into the buffer</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of bytes used to encode <code>value</code> or <code>0</code> on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="encode_8c_source.html#l00045">45</a> of file <a class="el" href="encode_8c_source.html">encode.c</a>.</p>

</div>
</div>
<a id="a671b4261b2d24de8696258a8efb0f359" name="a671b4261b2d24de8696258a8efb0f359"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a671b4261b2d24de8696258a8efb0f359">&#9670;&#160;</a></span>coap_fls()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int coap_fls </td>
          <td>(</td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>i</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">extern</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8c_source.html#l00020">20</a> of file <a class="el" href="encode_8c_source.html">encode.c</a>.</p>

</div>
</div>
<a id="a5732d87decbffe771159ea02a5e25488" name="a5732d87decbffe771159ea02a5e25488"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5732d87decbffe771159ea02a5e25488">&#9670;&#160;</a></span>coap_flsll()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int coap_flsll </td>
          <td>(</td>
          <td class="paramtype">long long&#160;</td>
          <td class="paramname"><em>i</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">extern</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8c_source.html#l00026">26</a> of file <a class="el" href="encode_8c_source.html">encode.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_a14d23a24002734ac2a3b997119f008e.html">coap2</a></li><li class="navelem"><a class="el" href="encode_8h.html">encode.h</a></li>
    <li class="footer">Generated on Fri Dec 27 2024 09:57:44 for libcoap by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
  </ul>
</div>
</body>
</html>
